package com.ts.api.common.constant.channel;

import com.ts.api.common.context.ChannelContext;
import com.ts.api.module.channel.entity.po.ChannelPO;

/**
 *  渠道版本枚举
 */
public enum ChannelVersionEnum {

    H5_V1(0),
    H5_V2(1),
    APP_V1(2),
    API_V1(10),
    /** apiV2版本 */
    API_V2(11),
    /** 自建站信息流 */
    INFO_FLOW(20),
    ;

    /** 版本号 */
    private final Integer version;

    /**
     * 构造函数
     *
     * @param version
     */
    private ChannelVersionEnum(Integer version) {
        this.version = version;
    }

    public Integer getVersion() {
        return version;
    }

    public boolean hasVersion() {
        ChannelPO channelPO = ChannelContext.get();
        return this.getVersion().equals(channelPO.getVersion());
    }
}
